package scutiger.util;

/**
 * @author LEI
 * Created by LEI on 2020/4/9.
 */
class StringUtils {
    private final static String NUL = "NULL";
    private final static String UND = "UNDEFINED";
    private final static String NVL = "NVL";
    private final static String T = "T";
    private final static String numRegx = "[0-9]+";

     static boolean isEmpty(String str){
         return str == null
                 || str.trim().length() == 0
                 || str.toUpperCase().equals(NUL)
                 || str.toUpperCase().equals(UND)
                 || str.toUpperCase().equals(NVL);
     }

     static boolean transformBoolean(String str){
        if(isEmpty(str)){
            return false;
        }
        if(str.toUpperCase().contains(T)){
            return true;
        }
        if(str.matches(numRegx)){
            double num = Double.valueOf(str);
            double zero = 0.0;
            return num != zero;
        }
        return false;
    }

}
